﻿#ifndef _OI_PLSCANNERCORE_TITLEWIDGET_HPP_
#define _OI_PLSCANNERCORE_TITLEWIDGET_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class OI_PLSCANNER_CORE_API TitleWidget : public QWidget
        {
            Q_OBJECT
        public:
            TitleWidget(QWidget * parent = Q_NULLPTR);
            ~TitleWidget();

        protected:
            void paintEvent(QPaintEvent *evt);

        private:
            OI_DISABLE_COPY(TitleWidget);
            OI_DECLARE_IMPL(TitleWidget);
        };

        class OI_PLSCANNER_CORE_API TitleButton : public QWidget
        {
            Q_OBJECT
        public:
            TitleButton(QBoxLayout::Direction dir = QBoxLayout::TopToBottom, QWidget* parent = Q_NULLPTR);
            ~TitleButton();

            QAction* action();

            void setAction(QAction* action, const QString icon);

            void setIcon(const QString path);

            void setText(const QString text);

            void setMarkWidth(int);

            void setMarkOrientation(int);

            void setBackgroundColor(const QColor bgColor);

            bool isChecked();

        public slots:
            void setChecked(bool isChecked);

            void setTouched(bool isTouched);

        signals:
            void triggered();

        protected:
            void enterEvent(QEvent *event);

            void leaveEvent(QEvent *event);

            void mousePressEvent(QMouseEvent *event);

            void mouseReleaseEvent(QMouseEvent *event);

            void paintEvent(QPaintEvent *event);

        private:
            OI_DISABLE_COPY(TitleButton);
            OI_DECLARE_IMPL(TitleButton);
        };

    }
}

#endif

